<?php
    //建立数据库连接
    include("../inc/dbconn.php");

    $number=$_POST["number"];
    $name = $_POST["name"];
    $sex=$_POST["sex"];
    $role=$_POST["role"];
    $department=$_POST["department"];
    $email=$_POST["email"];
    $tel = $_POST["tel"];
    $date = $_POST["date"];

    $sql = "insert into users (number,name,sex,role,department,email,tel,date) values ('$number','$name','$sex','$role','$department','$email','$tel','$date')";
    if ($conn->query($sql) === TRUE){
        $data["code"] = 3000;
        $data['msg']='添加成功';
    }else{
        $data["code"] = 3001;
        $data['msg']='未知错误';
    }
    echo json_encode($data);
?>